<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use backend\controllers\CategoryController;
use common\models\category\Category;
use frontend\controllers\ListController;
use common\models\member\Member;
use common\models\setting\Setting;


?>
<?php 
    $data = Category::find()->where(['status' => 1, 'parent_id' => 0])->asArray()->all();
    $login = Yii::$app->user->identity;
	
	//电话号码
	$phone = '';
	try { $phone = Setting::findOne(['code'=>'phone'])->value;}
	catch(ErrorException $e){ }
	//网站logo
	$imgLOGO = '';
	try { $imgLOGO = Setting::findOne(['code'=>'imgLOGO'])->value;}
	catch(ErrorException $e){ }

?>
<!--header-->
    <div class="header">
        <!--header-top-->
        <div class="header-top">
            <div class="w1200   clearFloat">
                <div class="header-topleft floatLeft">
                    <span>
					<?php  echo date('Y').'年'.date('m').'月'.date('d').'日'; echo "&nbsp;&nbsp;&nbsp;";
					       $week=array("日","一","二","三","四","五","六"); echo "星期".$week[date("w")]; ?>
					</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span><img src="<?= yii::getAlias('@web');?>/images/picon.png" alt="" width="12" height="16" class="vertical-align">&nbsp;联系电话：<?= $phone;?> </span>
                </div>
                <div class="header-topright floatRight">
                    <?php if($login){
                        $member = Member::findOne(Yii::$app->user->identity->getID());
                    ?>
                    <a href="<?= yii\helpers\Url::to(['member/info']);?>" style="color: #fff">用户名：<?= $member['username'] ?></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;<a href="<?= yii\helpers\Url::to(['auth/logout']);?>"><img src="<?= yii::getAlias('@web');?>/images/tui.png" alt="" width="47" height="21" class="vertical-align"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <?php }else{?>
                    <a href="<?= yii\helpers\Url::to(['auth/login']);?>"><img src="<?= yii::getAlias('@web');?>/images/deng.png" alt="" width="47" height="21" class="vertical-align"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<?= yii\helpers\Url::to(['auth/signup']);?>"><img src="<?= yii::getAlias('@web');?>/images/zhu.png" alt="" width="47" height="21" class="vertical-align"></a>
                    <?php } ?>
                </div>
            </div>
        </div>
        <!--header-top end-->
        <!--header-content-->
        <div class="header-content">
            <div class="w1200 clearFloat pt20 pb10">
                <div class="header-contentleft floatLeft">
                    <div class="logo">
                        <a href="<?= yii\helpers\Url::to(['/']);?>"><img src="/upload/<?= $imgLOGO;?>" alt="网站logo" width="521" height="75"></a>
                    </div>
                </div>
                <div class="header-contright floatRight">
                    <div class="search relative">
                        <form method="get" action="<?= yii\helpers\Url::to(['list/search']);?>">
                            <input name="keywords"type="text" class="searinput" placeholder="请输入要搜索的关键词" />
                            <input class="searsub" type="submit" value="搜索" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!--header-content end-->

    </div>
    <!--header end-->
    <!--nav-->
	 
    <div class="nav">
        <div class="w1200" style="overflow: hidden">
            <ul class="navul clearFloat">
                <li <?php if(!isset($this->params['tid'])){ echo 'class="navactive"'; }?>>
                    <a href="<?= yii\helpers\Url::to(['/']);?>">首页</a>
                </li>
				<?php foreach($data as $vo){ $newurl = '/'.$vo['type']; ?>
                <li <?php if(!isset($this->params['tid'])) {

				}else{ 
				if($this->params['tid'] == $vo['id']){ echo 'class="navactive"'; }}?>>
                    <a href="<?= yii\helpers\Url::to([$newurl, 'id' => $vo['id']]); ?>"><?= $vo['name'];?></a>
                </li>
                <?php } ?>
            </ul>
        </div>
    </div>
    <!--nav end-->
    
    